import { $t } from '@vben/locales';

export function formatStatusMessage(status?: number) {
  let errorMessage = '';
  switch (status) {
    case 400: {
      errorMessage = $t('ui.fallback.http.badRequest');
      break;
    }
    case 401: {
      errorMessage = $t('ui.fallback.http.unauthorized');
      break;
    }
    case 403: {
      errorMessage = $t('ui.fallback.http.forbidden');
      break;
    }
    case 404: {
      errorMessage = $t('ui.fallback.http.notFound');
      break;
    }
    case 408: {
      errorMessage = $t('ui.fallback.http.requestTimeout');
      break;
    }
    default: {
      errorMessage = $t('ui.fallback.http.internalServerError');
    }
  }
  return errorMessage;
}
